package two_shang._11_23;

import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;

public class IOStream {
    //桌面地址
    //C:\Users\李学健\Desktop
    public static void main(String[] args) throws IOException {
        File file = new File("C:\\Users\\李学健\\Downloads\\3221306130-李学健-实验1(模板).docx");
        //System.out.println(file);
        //System.out.println(file.getName());
        //System.out.println(file.getAbsoluteFile());
        //System.out.println(file.getParent());
        //System.out.println(file.getParentFile());
        //System.out.println(file.isFile());
        //System.out.println(file.isAbsolute());

        File file1 = new File("C:\\Users\\李学健\\Downloads");
        if (file1.isDirectory()) {
            String[] list = file1.list();
            for (String name : list) {
                System.out.println(name);
            }
        }


        //匿名类
        FilenameFilter filter = new FilenameFilter() {
            @Override
            public boolean accept(File dir, String name) {
                File currFile = new File(dir, name);
                //返回它是否以 .java 结尾
                return currFile.isFile() && name.endsWith(".java");
            }
        };


    }


}
